<?php

/**
 * MasterDirectory filter form base class.
 *
 * @package    campaign_generation
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseMasterDirectoryFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'                     => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'domain'                   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'deleted'                  => new sfWidgetFormFilterInput(),
      'directory_type_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DirectoryType'), 'add_empty' => true)),
      'parent_id'                => new sfWidgetFormFilterInput(),
      'home_template_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Template'), 'add_empty' => true)),
      'analytics_script'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'search_title'             => new sfWidgetFormFilterInput(),
      'user_id'                  => new sfWidgetFormFilterInput(),
      'language_id'              => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Language'), 'add_empty' => true)),
      'theme_color'              => new sfWidgetFormFilterInput(),
      'search_button_caption'    => new sfWidgetFormFilterInput(),
      'fb_app'                   => new sfWidgetFormFilterInput(),
      'search_in_sitemap'        => new sfWidgetFormFilterInput(),
      'analytics_metatag'        => new sfWidgetFormFilterInput(),
      'price_formula_a'          => new sfWidgetFormFilterInput(),
      'price_formula_b'          => new sfWidgetFormFilterInput(),
      'currency_symbol'          => new sfWidgetFormFilterInput(),
      'google_site_verification' => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'name'                     => new sfValidatorPass(array('required' => false)),
      'domain'                   => new sfValidatorPass(array('required' => false)),
      'deleted'                  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'directory_type_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('DirectoryType'), 'column' => 'id')),
      'parent_id'                => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'home_template_id'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Template'), 'column' => 'id')),
      'analytics_script'         => new sfValidatorPass(array('required' => false)),
      'search_title'             => new sfValidatorPass(array('required' => false)),
      'user_id'                  => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'language_id'              => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Language'), 'column' => 'id')),
      'theme_color'              => new sfValidatorPass(array('required' => false)),
      'search_button_caption'    => new sfValidatorPass(array('required' => false)),
      'fb_app'                   => new sfValidatorPass(array('required' => false)),
      'search_in_sitemap'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'analytics_metatag'        => new sfValidatorPass(array('required' => false)),
      'price_formula_a'          => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'price_formula_b'          => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'currency_symbol'          => new sfValidatorPass(array('required' => false)),
      'google_site_verification' => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('master_directory_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'MasterDirectory';
  }

  public function getFields()
  {
    return array(
      'id'                       => 'Number',
      'name'                     => 'Text',
      'domain'                   => 'Text',
      'deleted'                  => 'Number',
      'directory_type_id'        => 'ForeignKey',
      'parent_id'                => 'Number',
      'home_template_id'         => 'ForeignKey',
      'analytics_script'         => 'Text',
      'search_title'             => 'Text',
      'user_id'                  => 'Number',
      'language_id'              => 'ForeignKey',
      'theme_color'              => 'Text',
      'search_button_caption'    => 'Text',
      'fb_app'                   => 'Text',
      'search_in_sitemap'        => 'Number',
      'analytics_metatag'        => 'Text',
      'price_formula_a'          => 'Number',
      'price_formula_b'          => 'Number',
      'currency_symbol'          => 'Text',
      'google_site_verification' => 'Text',
    );
  }
}
